/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package ec.com.farmaciassantamartha.comprobantes.portal.util;

import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.Reader;

/**
 *
 * @author Rolando
 */
public class Archivo {

    public static String archivoToString(String rutaArchivo) {
        StringBuilder buffer = new StringBuilder();
        try {
            FileInputStream fis = new FileInputStream(rutaArchivo);
            InputStreamReader isr = new InputStreamReader(fis, "UTF-8");
            Reader in = new BufferedReader(isr);
            int ch;
            while ((ch = in.read()) > -1) {
                buffer.append((char) ch);
            }
            in.close();
            return buffer.toString().trim();
        } catch (IOException e) {
            e.printStackTrace();
        }
        return null;
    }
    
    public static void main(String[] args) {
        System.out.println(archivoToString("C:\\XML_AUT\\0209201401099151520800110010010000000060000000013.xml"));
    }
}
